import requests


s = requests.session()
print("登录之前",s.cookies)
# 登录
url = "http://127.0.0.1:8000/api/user/login"
r = s.post(url, json={'userName': 'admin', 'password': '123456', 'remember': False})
print(r.text)
print(r.json())
print("登录之后",s.cookies)


url = "http://127.0.0.1:8000/api/admin/education/subject/page"
cs = {"level": None, "pageIndex": 1, "pageSize": 10}
r = s.post(url, json=cs)
print(r.json())
assert r.json()['message'] == '成功'
assert r.json()['code'] == 1

url = "http://127.0.0.1:8000/api/user/logout"
r = s.post(url)
print("退出登录之后",s.cookies)
s.close()
